(function(){
    var doc = window.document;
    var docEl = doc.documentElement;
    var meta = window.document.querySelector('meta[name="viewport"]');
    if(!meta){
        meta = doc.createElement('meta');
        meta.setAttribute("name","viewport");
        meta.setAttribute("content","initial-scale=1,maximum-scale=1,user-scalable=no,width=device-width");
        docEl.firstElementChild.appendChild(meta);
    }
    //在外部可remove掉seRem方法
    //调用window.removeEventListener("resize", window.setRem, false);
    var setRem = function (){
        var w =  docEl.getBoundingClientRect().width;
        var v = (w/6.4).toFixed(1);
        docEl.setAttribute('style',"font-size:"+v+"px");
    };

    setRem();

    window.setRem = setRem;

    window.addEventListener('resize',window.setRem, false);

})();